package com.zero.manage.web.components.service.impl;

import com.zero.manage.web.components.dao.SysDictDetailsDao;
import com.zero.manage.web.components.entity.QSysDictDetailsEntity;
import com.zero.manage.web.components.entity.SysDictDetailsEntity;
import com.zero.manage.web.components.query.SysDictDetailsQuery;
import com.zero.manage.web.components.service.SysDictDetailsService;
import io.gitee.zerowsh.util.PublicResult;
import com.zero.manage.web.components.base.BaseService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 系统字典详情 业务接口实现
 *
 * @author zero
 */
@Service
public class SysDictDetailsServiceImpl extends BaseService<SysDictDetailsEntity, String, SysDictDetailsDao, SysDictDetailsQuery> implements SysDictDetailsService {

    private QSysDictDetailsEntity qSysDictDetailsEntity = QSysDictDetailsEntity.sysDictDetailsEntity;

    @Override
    public PublicResult<List<SysDictDetailsEntity>> getIdByDictCodeIn(List<String> dictCodes) {
        return PublicResult.queryOk(jpa.select(qSysDictDetailsEntity)
                .from(qSysDictDetailsEntity)
                .where(qSysDictDetailsEntity.dictCode.in(dictCodes))
                .orderBy(qSysDictDetailsEntity.dictCode.asc(), qSysDictDetailsEntity.sort.asc())
                .fetch());
    }
}
